package service.facade.admin;

import dao.inte.UserRepository;
import domain.User;

import javax.inject.Inject;
import java.util.List;

public class AdminFacadeImpl implements AdminFacade {
    @Inject
    UserRepository userRepository;

    public void saveUser(User user) throws Exception {
        userRepository.save(user);
    }

    public void updateUser(User user) throws Exception {
        userRepository.save(user);
    }

    public void deleteUser(User user) {
        userRepository.delete(user);
    }

    public List<User> findAllUsers() {
        return userRepository.findAll();
    }

    public User findUserById(long userId) {
        return userRepository.findById(userId);
    }
}
